import { ApiProperty } from '@midwayjs/swagger';
import { Rule, RuleType } from '@midwayjs/validate';
import { alternatives } from '..';
import { ProcessFilesSchema } from '../../schema';

export class SaveProcessFilesValidator implements ProcessFilesSchema {
  @ApiProperty({
    type: 'string',
    title: '处理后的文件路径',
    example: 'null',
    description: '处理后的文件路径',
    required: true,
  })
  @Rule(RuleType.string().required())
  path: string;

  @ApiProperty({
    type: 'string',
    title: '处理耗时',
    example: 'null',
    description: '处理耗时',
    required: true,
  })
  @Rule(RuleType.string().required())
  diffTime: string;
}

export class EditProcessFilesValidator implements Partial<ProcessFilesSchema> {
  @ApiProperty({
    type: 'string',
    title: '处理后的文件路径',
    example: 'null',
    description: '处理后的文件路径',
    required: false,
  })
  @Rule(RuleType.alternatives(alternatives))
  path?: string;

  @ApiProperty({
    type: 'string',
    title: '处理耗时',
    example: 'null',
    description: '处理耗时',
    required: false,
  })
  @Rule(RuleType.alternatives(alternatives))
  diffTime?: string;
}
